package com.maikang.exammall.service; import com.maikang.exammall.repository.KefuRepository;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.List;


@Log4j2
@Service
@RequiredArgsConstructor
public class KefuService {
    private final KefuRepository repository;

    @SneakyThrows
    public List<String> findAllKefuId() {
        List<String> names = repository.findNameByIsOnline();
        if (ObjectUtils.isEmpty(names)) {
            names = repository.findName();
        }
        return names;
    }
}
